package cn.tedu.delivery.controller;

import cn.tedu.delivery.mapper.ShopTypeMapper;
import cn.tedu.delivery.pojo.entity.ShopType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "骑手管理")
@RestController
@Slf4j
@RequestMapping("/shopType/")
public class ShopTypeController {

    @Autowired
    private ShopTypeMapper shopTypeMapper;

    @PostMapping("save")
    @ApiOperation(value = "新增类别")
    public int save(String shopTypeName){
        log.debug("shopTypeName="+shopTypeName);
        return shopTypeMapper.insertShopType(shopTypeName);
    }

    @DeleteMapping("{shopID}")
    @ApiOperation(value = "删除分类")
    @ApiImplicitParam(name = "shopID",value = "商店ID",required = true,dataType = "int")
    public int shopTypeID(@PathVariable Integer shopID){
        log.debug("shopID="+shopID);
        return shopTypeMapper.deleteShopID(shopID);
    }
}
